home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Personal Computer World 2009 February
/
PCWFEB09.iso
/
Software
/
Resources
/
Chat & Communication
/
Digsby build 37
/
digsby_setup.exe
/
lib
/
pyxmpp
/
sasl
/
gssapi.pyo
(
.txt
)
< prev
next >
Wrap
Python Compiled Bytecode
|
2008-10-13
|
2KB
|
53 lines
# Source Generated with Decompyle++
# File: in.pyo (Python 2.5)
__revision__ = '$Id$'
__docformat__ = 'restructuredtext en'
import base64
import kerberos
import logging
from pyxmpp.sasl.core import ClientAuthenticator, Failure, Response, Challenge, Success
class GSSAPIClientAuthenticator(ClientAuthenticator):
def __init__(self, password_manager):
ClientAuthenticator.__init__(self, password_manager)
self.password_manager = password_manager
self._GSSAPIClientAuthenticator__logger = logging.getLogger('pyxmpp.sasl.gssapi.GSSAPIClientAuthenticator')
def start(self, username, authzid):
self.username = username
self.authzid = authzid
if not authzid:
pass
(rc, self._gss) = kerberos.authGSSClientInit('%s@%s' % ('xmpp', self.password_manager.get_serv_host()))
self.step = 0
return self.challenge('')
def challenge(self, challenge):
if self.step == 0:
rc = kerberos.authGSSClientStep(self._gss, base64.b64encode(challenge))
if rc != kerberos.AUTH_GSS_CONTINUE:
self.step = 1
elif self.step == 1:
rc = kerberos.authGSSClientUnwrap(self._gss, base64.b64encode(challenge))
response = kerberos.authGSSClientResponse(self._gss)
rc = kerberos.authGSSClientWrap(self._gss, response, self.username)
response = kerberos.authGSSClientResponse(self._gss)
if response is None:
return Response('')
else:
return Response(base64.b64decode(response))
def finish(self, data):
self.username = kerberos.authGSSClientUserName(self._gss)
self._GSSAPIClientAuthenticator__logger.debug('Authenticated as %s' % kerberos.authGSSClientUserName(self._gss))
return Success(self.username, None, self.authzid)